﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Assets.Scripts.Common;

public class WindowMgr : MonoSingleton<WindowMgr>
{
    private Dictionary<int,GameObject> _luaObjectDic = new Dictionary<int, GameObject>();

    public static int INVALID_ID = -1;

    private int nextWindowId = 0;

    protected override void Awake()
    {
        base.Awake();
        _luaObjectDic.Clear();
        nextWindowId = 0;
    }

    public int IncWindow()
    {
        return nextWindowId ++;
    }

    public int Add(GameObject obj)
    {
        _luaObjectDic[nextWindowId] = obj;
        IncWindow();
        return nextWindowId - 1;
    }

    public GameObject Get(int windowId)
    {
        return _luaObjectDic[windowId];
    }

    public void Remove(int windowId)
    {
        _luaObjectDic.Remove(windowId);
    }

}
